package ru.nsu.ccfit.kalah.activity;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.SeekBar;
import ru.nsu.ccfit.kalah.R;


public class SettingsActivity extends Activity {
    public static final int DEFAULT_AI_LEVEL = 5;
    public static final String PREFERENCE_LEVEL = "level";
  private   SeekBar seekBar;
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_settings);

        seekBar = (SeekBar) findViewById(R.id.seekbar);

        SharedPreferences preferences = getPreferences(Context.MODE_PRIVATE);
        seekBar.setProgress(preferences.getInt(PREFERENCE_LEVEL, DEFAULT_AI_LEVEL));

    }

    public void onClickApply(View v) {


        int value = seekBar.getProgress();

        SharedPreferences preferences = getPreferences(Context.MODE_PRIVATE);
        preferences.edit().putInt(PREFERENCE_LEVEL, value).commit();

        finish();
    }
}